import fs from 'fs';
import axios from 'axios';
import OpenAI from 'openai';

const client = new OpenAI({
    apiKey: 'sk-nuC4731b7c50c71f87227cbfd8f1915633d20b70797CcEGj',
    baseUrl: 'https://wildcard.com.cn/api'
})

async function textToSpeech(content) {
    try {
        const response = await client.audio.speech.create({
            model: 'whisper-1',
            message: [{
                role: 'system',
                content
            }]
        })
        console.log(response.data)
    } catch (err) {
        console.log('文本转语音失败了', err)
    }
}

textToSpeech('你好，我是富婆姚');